package com.heneng.bluetoothdemo;


import com.heneng.bluetoothdemo.dialog.WaitingDialog;

import androidx.fragment.app.FragmentActivity;

/**
 * Created by fengzimin  on  2020/12/3.
 * interface by
 */
public class BaseActivity extends FragmentActivity {
    private WaitingDialog mWaitingDialog;


    public void showWaitingDialog(String text, boolean cancelable) {
        if (this.mWaitingDialog == null) {
            this.mWaitingDialog = WaitingDialog.newDialog(this).setMessage(text);
        }

        if (this.mWaitingDialog.isShowing()) {
            this.mWaitingDialog.dismiss();
        }

        this.mWaitingDialog.setMessage(text);
        this.mWaitingDialog.setCancelable(cancelable);
        this.mWaitingDialog.show();
    }


    public void showWaitingDialog(int stringRes, boolean cancelable) {
        this.showWaitingDialog(this.getString(stringRes), cancelable);
    }


    public void dismissWaitingDialog() {
        if (this.mWaitingDialog != null && this.mWaitingDialog.isShowing()) {
            this.mWaitingDialog.dismiss();
        }
    }
}
